package com.kunminx.viabus.business.bus.business.bus;

import com.kunminx.core.bus.Result;
import com.kunminx.viabus.business.constant.NoteResultCode;
import com.kunminx.viabus.repertory.bean.NoteBean;
import org.junit.Test;

import static org.junit.Assert.*;

public class ResultTest {

    private final NoteBean bean = new NoteBean();

    private final Result result = new Result(NoteResultCode.INSERTED, bean);

    @Test
    public void getResultCode() {
        Object resultCode = result.getResultCode();
        assertEquals(NoteResultCode.INSERTED, resultCode.toString());
    }

    @Test
    public void setResultCode() {
        Object resultCode = "test";
        result.setResultCode(resultCode);
        Object getResultCode = result.getResultCode();
        assertEquals(resultCode, getResultCode);
    }

    @Test
    public void getResultObject() {
        Object resultCode = result.getResultCode();
        assertEquals(NoteResultCode.INSERTED, resultCode.toString());
    }

    @Test
    public void setResultObject() {
        Object resultCode = "test";
        result.setResultCode(resultCode);
        Object getResultCode = result.getResultCode();
        assertEquals(resultCode, getResultCode);
    }

    @Test
    public void setTag() {
        result.setTag("TAG");
        String TAG = result.getTag();
        assertEquals("TAG", TAG);
    }

    @Test
    public void isSuccess() {
        result.setSuccess(true);
        boolean state = result.isSuccess();
        assertTrue(state);
    }
}